home *** CD-ROM | disk | FTP | other *** search
- Path: news.iag.net!news
- From: jatmon@iag.net (John R Buchan)
- Newsgroups: comp.lang.c
- Subject: Re: windows dll
- Date: 10 Jan 1996 13:18:56 GMT
- Organization: Internet Access Group, Orlando, Florida
- Message-ID: <4d0ec0$7aq@news.iag.net>
- References: <4csoom$q7t@felix.teclink.net>
- NNTP-Posting-Host: pm1-orl23.iag.net
- X-Newsreader: WinVN 0.99.7
-
- In article <4csoom$q7t@felix.teclink.net>, tmartin@teclink.net says...
- >
- >I am trying to compile someones source code for a DLL written
- >in MS C7.0. I am using VC 1.0. I keep getting errors saying
- >(warning C4135: conversion between different integral types).
- >
- >An example of the lines that give the error is listed below:
- >
- >*(ptr) = pCard->byCompression|pCard->wPlayMode;
- <snip>
-
- What are the types of ptr, pCard->byCompression, and pCard->wPlayMode?
-
- Typically, you might get this type of warning, if ptr is a pointer to
- a type that may not be able to store all possible results of the
- expression (eg, if ptr is pointer to char and either pCard->byCompression
- or pCard->wPlayMode is int). If this is the case and you are _certain_
- that your code protects against any out of range results, you can simply
- cast the result to silence the warning.
-
- #define TRUE 1
- #define FALSE 0
-
- struct my_struct
- {
- int byCompression;
- int wPlayMode;
- };
-
- int main()
- {
- char c, *ptr = &c;
- struct my_struct ms, *pCard = &ms;
-
- pCard->byCompression = TRUE;
- pCard->wPlayMode = FALSE;
-
- *(ptr) = pCard->byCompression|pCard->wPlayMode; /* warning */
- *(ptr) = (char)(pCard->byCompression|pCard->wPlayMode); /* no warning */
-
- return (0);
- }
-
- <Compiled on MSVC 1.5 with warning level set at 4.>
-
- --
- John R Buchan -:|:- Looking for that elusive FAQ? ftp to:
- jatmon@mail.iag.net -:|:- rtfm.mit.edu /pub/usenet-by-group/....
-
-